﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectTree.aspx.cs" Inherits="Honestysoft.Financing.WebUI.Module.Project.ProjectTree" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" href="../../Scripts/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css" />
	<script type="text/javascript" src="../../Scripts/zTree/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="../../Scripts/zTree/js/jquery.ztree.core-3.0.js"></script>
	<script type="text/javascript" src="../../Scripts/zTree/js/jquery.ztree.excheck-3.0.js"></script>
	<script type="text/javascript" src="../../Scripts/zTree/js/jquery.ztree.exedit-3.0.js"></script>

    <script type="text/javascript">
        var setting = {
            view: {
		        selectedMulti: false
	        },
            edit: {
                enable: true,
                showRemoveBtn: false,
                showRenameBtn: false
            },
            async: {
                enable: true,
                url: "ProjectInfo.ashx",
                autoParam: ["id"],
                otherParam: {"<%=Honestysoft.Financing.WebUI.Module.Project.Utils.ParamName_ProjectTreeModule %>":"<%=Request[Honestysoft.Financing.WebUI.Module.Project.Utils.ParamName_ProjectTreeModule] %>","FunctionID":"<%=Request["FunctionID"]+"" %>" },
                dataFilter: null
            },
            callback: {
                onAsyncSuccess: zTreeOnAsyncSuccess,
                beforeDrag: beforeDrag,
                beforeDrop: beforeDrop,
                beforeClick: beforeClick,
				onClick: onClick
            }
        };
        function beforeDrag(treeId, treeNodes) {
            return false;
        }
        function beforeDrop(treeId, treeNodes, targetNode, moveType) {
            return false;
        }
        function beforeClick(treeId, treeNode, clickFlag) {
            
		}
        function onClick(event, treeId, treeNode, clickFlag) {
            if(!treeNode.open){
                var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			    zTree.expandNode(treeNode);
            }
            window.parent.frames[treeNode.target].location.href=treeNode.url+"&NodeType="+treeNode.nodeType+"&NodeText="+ escape(treeNode.name)+"&FunctionID=<%=Request["FunctionID"]+"" %>";
		}	
        var isFirst=true;
        $(document).ready(function () {
            $.fn.zTree.init($("#treeDemo"), setting);            
        });
        function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
            if (isFirst) {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo");
                var nodes = zTree.getNodes();
                zTree.selectNode(nodes[0]);
                isFirst=false;
                zTree.expandNode(nodes[0]);                
            }
        };
	</script>
</head>
<body>
    <form id="form1" runat="server">
     <div class="zTreeDemoBackground left">
		<ul id="treeDemo" class="ztree"></ul>
	</div>
    </form>
</body>
</html>
